SetGfxDriver 1:Graphics 1024,768,8,2:SeedRnd MilliSecs() :SetBuffer FrontBuffer() 

nums = CreateBank(4096):numw = CreateBank(4096)
For i = 0 To 4096 
t = Rand(0,255):PokeByte nums,i, t:PokeByte numw,i, t
Next 

While Not KeyHit(1) 
Cls  
For i1=0 To 63
For i=0 To 63
If PeekByte(numw,i*64+i1)>127 Color 0,255,0:Text i*16,i1*9+9,PeekByte(numw,i*64+i1),False ,False Else Color 0, PeekByte(numw,i*64+i1),0:Text i*16,i1*9+9,PeekByte(numw,i*64+i1),False ,False

Text 10,700,"1",False ,False 
Next
Next
Flip
WaitMouse()
Cls
For i1=1 To 500
For i = 0 To 4095 
ttt=PeekByte(nums,i)
If ttt>127 Then PokeByte nums,i,((PeekByte (nums,i+1)+1) Mod 255):PokeByte(nums,i+1,ttt)
Next 
If PeekByte (nums,4096)>127 ttt= PeekByte (nums,4096):PokeByte nums,4096,((PeekByte(nums,0)+1) Mod 255):PokeByte(nums,0,ttt)
Next

For i1=0 To 63
For i=0 To 63
If PeekByte(nums,i*64+i1)>127 Color 0,255,0:Text i*16,i1*9+9,PeekByte(nums,i*64+i1),False ,False Else Color 0, PeekByte(nums,i*64+i1),0:Text i*16,i1*9+9,PeekByte(nums,i*64+i1),False ,False

Text 10,700,"2",False ,False
Next
Next
Flip
WaitMouse()


Cls
For i1=1 To 500
For i = 4096 To 1 Step -1 
ttt=PeekByte(nums,i)
If ttt>127 Then PokeByte nums,i,mod2(PeekByte (nums,i-1)-1):PokeByte(nums,i-1,ttt)
Next
If PeekByte (nums,0)>127 ttt= PeekByte (nums,0):PokeByte nums,0,((PeekByte(nums,4096)+1) Mod 255):PokeByte(nums,4096,ttt)
Next

For i1=0 To 63
For i=0 To 63
If PeekByte(nums,i*64+i1)>127 Color 0,255,0:Text i*16,i1*9+9,PeekByte(nums,i*64+i1),False ,False Else Color 0, PeekByte(nums,i*64+i1),0:Text i*16,i1*9+9,PeekByte(nums,i*64+i1),False ,False

Text 10,700,"3",False ,False 
Next
Next

Flip 
WaitMouse()
If KeyHit(57) > 0 WaitMouse()
Wend 

Function mod2(modx)
If modx<0 Return modx=255-modx Else Return (modx Mod (255))
End Function